<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" th:src="@{/resource/plugins/jquery/dist/jquery.js}"></script>

<script type="text/javascript" th:src="@{/websocket/sockjs.min.js}"></script>
<script type="text/javascript" th:src="@{/websocket/stomp.js}"></script>

</head>
<body>
websocket 测试
 <div id="conversationDiv">  
            <p id="response"></p>  
        </div>  
<script type="text/javascript"> 
var stompClient = null;  

function connect() {  
    var socket = new SockJS("/webSocketServer");  
    stompClient = Stomp.over(socket);  
    stompClient.connect({}, function(frame) {  
        console.log('Connected: ' + frame);  
        stompClient.subscribe('/topic/test', function(response){  
            console.log(JSON.parse(response.body)); 
            
        });  
    });  
}  
$(function(){
	connect() ;
	
})
	
 
</script>
</body>
</html>